package com.company.service.impl;
import com.company.service.BaseService;
import com.company.service.StartService;
import com.company.utils.ServiceFactory;

import java.util.Scanner;

public class StartServiceImpl implements StartService {
  static  UserServiceImpl userService=new UserServiceImpl();
    @Override
    public void execute() {
        Scanner sc=new Scanner(System.in);
        while(true){
            System.out.println("欢迎使用书虫阅读器");
            System.out.println("---------------");
            System.out.println("1.登录");
            System.out.println("2.注册");
            System.out.println("3.退出");
            System.out.println("---------------");
            System.out.println("请选择");
            int flag=sc.nextInt();
            switch (flag){
                case 1:
                    BaseService baseService = ServiceFactory.getBean("Login");
                    baseService.execute();
                    break;
                case 2:
                    BaseService baseService1 = ServiceFactory.getBean("Regist");
                    baseService1.execute();
                    break;
                case 3:
                    System.exit(0);
                    break;
                default:
                    System.out.println("请输入有效数字");
                    break;
            }
        }

    }
}
